<script>
    /**
     * 保存标签
     */
    function save() {

        $(this).bjuiajax('doAjax', {

            url: '/api/tag/edit',
            type: 'post',
            data: {
                id: $('#id').val(),
                name: $('#name').val(),
                description: $('#description').val(),
                slug: $('#slug').val()
            },
            callback: function(result) {

                if (result.statusCode === '200') {
                    $(this).alertmsg('info', result.message);
                    // $(this).dialog('close');
                    $(this).dialog('closeCurrent');
                    // $(this).dialog("close",'指定的dialog ID');
                }
            }
        });
    }
</script>

<form action="/api/tag/edit" id="j_custom_form" data-toggle="validate">
    <input type="hidden" name="id" id="id" value="<%=tag.id%>">
    <table class="table table-condensed table-hover">
        <tbody>
            <tr>
                <td colspan="2">
                    <label for="j_dialog_image" class="control-label x90">标签配图：</label>
                    <div style="display: inline-block; vertical-align: middle;">
                        <div id="j_custom_pic_up" data-toggle="upload" data-uploader="/api/file/upload" data-file-size-limit="1024000000" data-file-type-exts="*.jpg;*.png;*.gif;*.mpg" data-multi="false" data-on-upload-success="pic_upload_success" data-icon="cloud-upload"></div>
                        <input type="hidden" name="custom.pic" value="" id="j_custom_pic">
                        <img id="article_img" src="" width="200" height="100">
                        <span id="j_custom_span_pic"></span>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label for="name" class="control-label x90">标签名称：</label>
                    <input type="text" name="name" id="name" value="<%=tag.name%>" size="60">
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label for="description" class="control-label x90">标签简述：</label>
                    <textarea name="description" id="description" data-toggle="autoheight" cols="60" value="<%=tag.description%>" rows="4"><%=tag.description%></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label for="slug" class="control-label x90">标签URL：</label>
                    <input type="text" id="slug" name="slug" value="<%=tag.slug%>" size="60">
                </td>
            </tr>
        </tbody>
    </table>
</form>

<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">取消</button></li>
        <li><button type="submit" class="btn-default" data-icon="save" onclick="save()">保存</button></li>
    </ul>
</div>